package com.example.tbtx.tbtx;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.example.tbtx.tbtx.base.BaseActivity;

public class WebViewActivity extends BaseActivity {

    private WebView webView;

    @Override
    public int setLayout() {
        return R.layout.activity_web_view;
    }

    @Override
    public void initEvent() {
        webView = ((WebView) findViewById(R.id.webview));
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String request) {
                view.loadUrl(request);
                return true;
            }
        });
    }

    @Override
    public void initData() {
        String url = getIntent().getStringExtra("url");
        webView.loadUrl(url);
    }
}
